package com.rss.inbound.mappers;

import java.util.Date;

import com.rss.inbound.beans.RssEntry;
import com.rss.inbound.beans.RssSrc;
import com.rss.inbound.beans.Sts;
import com.sun.syndication.feed.synd.SyndEntry;

public class EngadgetRssMapper implements RssMapper
{
    @Override
    public RssEntry mapRssEntry(SyndEntry engadgetEntry, RssSrc rssSrc)
    {
	RssEntry rssEntry = new RssEntry();
	rssEntry.setRssSrc(rssSrc);
	rssEntry.setAthr(engadgetEntry.getAuthor());
	rssEntry.setTtl(engadgetEntry.getTitle());
	rssEntry.setEntryLnk(engadgetEntry.getUri());
	rssEntry.setCntn(engadgetEntry.getDescription().getValue().getBytes());
	rssEntry.setCntnFrmt(engadgetEntry.getDescription().getType());
	rssEntry.setPubDttm(engadgetEntry.getPublishedDate());

	Sts activeRssEntrySts = new Sts();
	activeRssEntrySts.setIdSts(3);
	rssEntry.setSts(activeRssEntrySts);
	rssEntry.setEntryStsDttm(new Date());
	rssEntry.setCreatBy("RssDownloaderBatch");
	rssEntry.setCreatDttm(new Date());
	rssEntry.setLastModBy("RssDownloaderBatch");
	rssEntry.setLastModDttm(new Date());
	return rssEntry;
    }

}
